package com.pphh.demo;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * Created by pphh on 2022/9/30.
 */
public class Logger {

    public static void logMessage(String msg) {
        String threadName = Thread.currentThread().getName();
        Long threadId = Thread.currentThread().getId();

        Date nowTime = new Date(System.currentTimeMillis());
        SimpleDateFormat sdFormatter = new SimpleDateFormat("yyyyMMdd HH:mm:ss-SSS");
        String strTime = sdFormatter.format(nowTime);

        String info = String.format("[%s][%s][tid=%s] %s", strTime, threadName, threadId, msg);
        System.out.println(info);
    }
}
